/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Utildao;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author Diego
 */
public class Utildao {
    private static  EntityManager entityManager=null;

public static EntityManager getEntityManager(){
    if ((entityManager==null) ||!entityManager.isOpen()) {
        EntityManagerFactory fabrica= Persistence.createEntityManagerFactory("PersistenciaFersa");
        entityManager= fabrica.createEntityManager();
    }
    return entityManager;


}

}
